home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / initMainMenuBar.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  24.4 KB  |  762 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Aug 15 1996
  22. //
  23. //  Description:
  24. //      This procedure creates the main menu bar with the various
  25. //    menu tabs: Modeling, Animation, Character, Dynamics, Rendering
  26. //
  27. //  NOTE:  If you add menus to any of the categories, remember to update the
  28. //  dimension of the corresponding array (ie: $gAnimationMenus, $gModelingMenus).
  29. //  If you don't, the script won't fail, but providing explicit array sizes ensures
  30. //  that excess memory is not needlessly allocated for the arrays.
  31. //    NOTE: modify to build common menus dynamically, then
  32. //    add the Motif accelerators to the hotkey file.
  33.  
  34.  
  35. /*
  36. //////////////////////////////////////////////////
  37. //
  38. //    Build the CHARACTER menus 
  39. //
  40. //////////////////////////////////////////////////
  41.  
  42. global proc genCharacterMenus( )
  43. {
  44.     global string $gCharacterMenus[];
  45.     int $menuIndex = 0;
  46.  
  47.     $gCharacterMenus[$menuIndex] = 
  48.         `menu -l "Deformations" -to true -aob true
  49.             -familyImage "menuIconDeformations.xpm"`;
  50.         menu -e -pmc ( "ChaDeformationsMenu " + $gCharacterMenus[$menuIndex] ) 
  51.             $gCharacterMenus[$menuIndex];
  52.         $menuIndex++;
  53.     setParent -m ..;
  54.  
  55.     $gCharacterMenus[$menuIndex] = 
  56.         `menu -l "Skeletons" -to true -aob true
  57.             -familyImage "menuIconSkeletons.xpm"`;
  58.         menu -e -pmc ( "ChaSkeletonsMenu " + $gCharacterMenus[$menuIndex] ) 
  59.             $gCharacterMenus[$menuIndex];
  60.         $menuIndex++;
  61.     setParent -m ..;
  62.  
  63.     $gCharacterMenus[$menuIndex] = 
  64.         `menu -l "Skin" -to true -aob true
  65.         -familyImage "menuIconSkinning.xpm"`; 
  66.     menu -e -pmc ( "ChaSkinningMenu " + $gCharacterMenus[$menuIndex] ) 
  67.         $gCharacterMenus[$menuIndex];
  68.         $menuIndex++;
  69.     setParent -m ..;
  70.  
  71.     // Reuse the Constraints from the ANIMATION menubar.
  72.     $gCharacterMenus[$menuIndex] = 
  73.         `menu -l "Constraints" -to true -aob true
  74.             -familyImage "menuIconConstraints.xpm"`; 
  75.         menu -e -pmc ( "AniConstraintsMenu " + $gCharacterMenus[$menuIndex] ) 
  76.             $gCharacterMenus[$menuIndex];
  77.         $menuIndex++;
  78.     setParent -m ..;
  79. }
  80. */
  81.  
  82.  
  83. proc changeMenusVisibility(string $menus[], int $visible)
  84. {
  85.     int $i;
  86.     int $menuSize = size($menus);
  87.  
  88.     for ($i = 0; $i < $menuSize; $i++) {
  89.         if (`menu -q -exists $menus[$i]`) {
  90.             menu -e -vis $visible $menus[$i];
  91.         }
  92.     }
  93. }
  94.  
  95.  
  96. global proc updateMenuModeUI()
  97. //
  98. //  Description:
  99. //    This procedure responds to the "MenuModeChanged" event and
  100. //    updates the visibility of the corresponding menus in the
  101. //    menu bar of the main Maya window.
  102. //
  103. //    This procedure also determines what menu modes are valid,
  104. //    and if an invalid menu mode was set to the "setMenuMode"
  105. //    command, then this procedure will set it back to "Animation"
  106. //    by default.
  107. //
  108. {    
  109.     global string $gModelingMenus[6];
  110.     global string $gAnimationMenus[6];
  111. //    global string $gCharacterMenus[4];
  112.     global string $gDynamicsMenus[7];
  113.     global string $gRenderingMenus[4];
  114.     global string $gClothMenus[3];
  115.     global string $gLiveMenus[5];
  116.     global string $gMenuModeButton;
  117.     global string $gMayaMode;
  118.  
  119.     string $state = `setMenuMode`;
  120.  
  121.     // don't change to new mode, unless it is loaded
  122.     //
  123.     int $stateAsInt;
  124.     string $newState = $state;
  125.  
  126.     if ($state == "Cloth")
  127.         if ( !(`exists cpSolver`) || !(`menuItem -q -exists clothMode`) )
  128.             $newState = "Animation";
  129.     
  130.     if ($state == "Live")
  131.         if ( !(`exists mlSolveCamera`) || !(`menuItem -q -exists liveMode`) )
  132.             $newState = "Animation";
  133.  
  134.     int $dynamicsOffset = 0;
  135.     if( `licenseCheck -m edit -type complete` == 0 )
  136.     {
  137.         $dynamicsOffset = -1;
  138.         if( $state == "Dynamics" )
  139.         {
  140.             $newState = "Animation";
  141.         }
  142.     }
  143.         
  144.     switch( $newState ) {
  145.         case "Modeling":
  146.             // text -e -l "Modeling" -w 90 modeText;
  147.             changeMenusVisibility($gModelingMenus, true);
  148.             changeMenusVisibility($gAnimationMenus, false);
  149. //            changeMenusVisibility($gCharacterMenus, false);
  150.             changeMenusVisibility($gDynamicsMenus, false);
  151.             changeMenusVisibility($gRenderingMenus, false);
  152.             changeMenusVisibility($gClothMenus, false);
  153.             changeMenusVisibility($gLiveMenus, false);
  154.             $stateAsInt = 2;
  155.             break;
  156.         case "Animation":
  157.             // text -e -l "Animation" -w 90 modeText;
  158.             changeMenusVisibility($gModelingMenus, false);
  159.             changeMenusVisibility($gAnimationMenus, true);
  160. //            changeMenusVisibility($gCharacterMenus, true);
  161.             changeMenusVisibility($gDynamicsMenus, false);
  162.             changeMenusVisibility($gRenderingMenus, false);
  163.             changeMenusVisibility($gClothMenus, false);
  164.             changeMenusVisibility($gLiveMenus, false);
  165.             $stateAsInt = 1;
  166.             break;
  167.         case "Dynamics":
  168.             // text -e -l "Dynamics" -w 90 modeText;
  169.             changeMenusVisibility($gModelingMenus, false);
  170.             changeMenusVisibility($gAnimationMenus, false);
  171. //            changeMenusVisibility($gCharacterMenus, false);
  172.             changeMenusVisibility($gDynamicsMenus, true);
  173.             changeMenusVisibility($gRenderingMenus, false);
  174.             changeMenusVisibility($gClothMenus, false);
  175.             changeMenusVisibility($gLiveMenus, false);
  176.             $stateAsInt = 3;
  177.             break;
  178.         case "Rendering":
  179.             // text -e -l "Rendering" -w 90 modeText;
  180.             changeMenusVisibility($gModelingMenus, false);
  181.             changeMenusVisibility($gAnimationMenus, false);
  182. //            changeMenusVisibility($gCharacterMenus, false);
  183.             changeMenusVisibility($gDynamicsMenus, false);
  184.             changeMenusVisibility($gRenderingMenus, true);
  185.             changeMenusVisibility($gClothMenus, false);
  186.             changeMenusVisibility($gLiveMenus, false);
  187.             $stateAsInt = 4 + $dynamicsOffset;
  188.             break;
  189.         case "Cloth":
  190.             changeMenusVisibility($gClothMenus, true);
  191.             changeMenusVisibility($gModelingMenus, false);
  192.             changeMenusVisibility($gAnimationMenus, false);
  193. //            changeMenusVisibility($gCharacterMenus, false);
  194.             changeMenusVisibility($gDynamicsMenus, false);
  195.             changeMenusVisibility($gRenderingMenus, false);
  196.             changeMenusVisibility($gLiveMenus, false);
  197.             $stateAsInt = 5 + $dynamicsOffset;
  198.             break;
  199.         case "Live":
  200.             changeMenusVisibility($gLiveMenus, true);
  201.             changeMenusVisibility($gModelingMenus, false);
  202.             changeMenusVisibility($gAnimationMenus, false);
  203. //            changeMenusVisibility($gCharacterMenus, false);
  204.             changeMenusVisibility($gDynamicsMenus, false);
  205.             changeMenusVisibility($gRenderingMenus, false);
  206.             changeMenusVisibility($gClothMenus, false);
  207.             $stateAsInt = 5 + $dynamicsOffset; 
  208.             break;
  209.         default:
  210.             //  If the current mode is not recognized then
  211.             //  set the current mode to Animation as the default.
  212.             //
  213.             setMenuMode "Animation";
  214.             return;
  215.  
  216.     }
  217.  
  218.     if (`optionMenu -q -exists $gMenuModeButton` && 
  219.         `optionMenu -q -v $gMenuModeButton` != $newState) {
  220.         optionMenu -e -sl $stateAsInt $gMenuModeButton;
  221.     }
  222.  
  223.     // Check if the selection made for Live/Cloth resulted properly
  224.     // Else the position of Cloth/Live may have to be interchanged.
  225.  
  226.     if((`optionMenu -q -value $gMenuModeButton` == "Cloth" && $newState == "Live") ||
  227.        (`optionMenu -q -value $gMenuModeButton` == "Live" && $newState == "Cloth"))
  228.     {
  229.         $stateAsInt = $stateAsInt + 1;
  230.         optionMenu -e -sl $stateAsInt $gMenuModeButton;
  231.     }
  232.  
  233.     // If Live Menu is getting unselected then hide the Popup
  234.     // Menu used for Live.
  235.  
  236.     if(isUIComponentVisible("Maya Live Control Panel") && 
  237.         $newState != "Live")
  238.     {
  239.         string $component;
  240.         $component = getUIComponent("Maya Live Control Panel");
  241.         layout -edit -manage false $component;
  242.     }
  243.  
  244.     optionVar -sv currentMenuBarTab $newState;
  245.     $gMayaMode = $state;
  246. }
  247.  
  248.  
  249. // note: i don't think this proc is ever called. this logic now all 
  250. // appears to be in statusLine.mel (Kevin Smith)
  251. //
  252. global proc genModePopupMenu( string $parent )
  253. {
  254.     setParent -m $parent;
  255.     if( `menu -q -ni $parent` != 0 ) {
  256.         return;
  257.     }
  258.     menuItem -l "Modeling" -c "setMenuMode Modeling";
  259.     menuItem -l "Animation" -c "setMenuMode Animation";
  260.     if( `licenseCheck -m edit -type complete` == 1 )
  261.     {
  262.         menuItem -l "Dynamics" -c "setMenuMode Dynamics";
  263.     }
  264.     menuItem -l "Rendering" -c "setMenuMode Rendering";
  265. }
  266.  
  267.  
  268. //global proc initMainMenuBar ( string $menuBarParent )
  269. {
  270. //    $menuBarParent = $gMainWindow;
  271.     string $menuModeText;
  272.     global string $gModelingMenus[6];
  273.     global string $gAnimationMenus[6];
  274. //    global string $gCharacterMenus[4];
  275.     global string $gDynamicsMenus[7];
  276.     global string $gRenderingMenus[4];
  277.  
  278.     int $Modeling = 0;
  279.     int $Animation = 1;
  280.     int $Dynamics = 3;
  281.     int $Rendering = 4;
  282.     int $menuIndex;
  283.     
  284.     // These globals are used to name the main menus so that
  285.     // users can add things to the end of the menus without
  286.     // hardcoding the name.
  287.     //
  288.     global string $gMainFileMenu    = "mainFileMenu";
  289.     global string $gMainEditMenu    = "mainEditMenu";
  290.     global string $gMainModifyMenu    = "mainModifyMenu";
  291.     global string $gMainDisplayMenu    = "mainDisplayMenu";
  292.     global string $gMainWindowMenu    = "mainWindowMenu";
  293.     global string $gMainOptionsMenu    = "mainOptionsMenu";
  294.     global string $gMainCreateMenu    = "mainCreateMenu"; 
  295.  
  296.     global string $gMainWindow;
  297.     
  298.     // Create Menu bar text field
  299.     // setParent $menuBarFormName;
  300.     // $menuModeText = `text -l "Modeling" -w 90 modeText`;
  301.  
  302.     //////////////////////////////////////////////////
  303.     //
  304.     //    Build the COMMON menu panes
  305.     //
  306.     //////////////////////////////////////////////////
  307.  
  308.     setParent $gMainWindow;
  309.  
  310.     if (`isTrue "BaseMayaExists"`) { 
  311.         if (`exists FileMenu`) { 
  312.             eval "source FileMenu";
  313.         }
  314.         if (`exists EditMenu`) { 
  315.             eval "source EditMenu";
  316.         }
  317.         $menu = `menu -l "Modify" -aob true -to true
  318.                 -familyImage "menuIconModify.xpm"
  319.                 $gMainModifyMenu`; 
  320.             menu -e -pmc ( "ModObjectsMenu " + $menu ) $menu;
  321.         setParent -m ..;
  322.  
  323.         // The Create menu 
  324.         menu -l "Create" -aob true -to true
  325.             -postMenuCommandOnce true
  326.             -familyImage "menuIconEdit.xpm"
  327.             $gMainCreateMenu; 
  328.         menu -e -pmc ( "ModCreateMenu " + $gMainCreateMenu ) 
  329.             $gMainCreateMenu; 
  330.         setParent -m ..;
  331.  
  332.         if (`exists DisplayMenu`) { 
  333.             eval "source DisplayMenu";
  334.         }
  335.         if (`exists ViewMenu`) { 
  336.             eval "source ViewMenu";
  337.         }
  338.  
  339.         if (`exists HotboxMenus`) { 
  340.             eval "source HotboxMenus";
  341.         }
  342.     
  343.         // Register some default Marking Menus with the Marking Menu Editor.
  344.         //
  345.         {
  346.             if (!`exists registerMenuWithMenuEditor` || !`exists isMenuRegisteredWithMenuEditor`) {
  347.                 eval "source menuEditorSetup";
  348.             }
  349.             if (`exists registerMenuWithMenuEditor` && `exists isMenuRegisteredWithMenuEditor`) {
  350.                 string $markingMenuAnnotation = "PA_Style_LMB";
  351.                 if (!isMenuRegisteredWithMenuEditor($markingMenuAnnotation))
  352.                     registerMenuWithMenuEditor(("menu_" + $markingMenuAnnotation),$markingMenuAnnotation);
  353.  
  354.                 $markingMenuAnnotation = "PA_Style_MMB";
  355.                 if (!isMenuRegisteredWithMenuEditor($markingMenuAnnotation))
  356.                     registerMenuWithMenuEditor(("menu_" + $markingMenuAnnotation),$markingMenuAnnotation);
  357.  
  358.                 $markingMenuAnnotation = "PA_Style_RMB";
  359.                 if (!isMenuRegisteredWithMenuEditor($markingMenuAnnotation))
  360.                     registerMenuWithMenuEditor(("menu_" + $markingMenuAnnotation),$markingMenuAnnotation);
  361.             }
  362.             else {
  363.                 warning "Cannot register menus with the Marking Menu Editor";
  364.             }
  365.         }
  366.     }
  367.  
  368.  
  369.     //////////////////////////////////////////////////
  370.     //
  371.     //    Build the MODELLING menus 
  372.     //
  373.     //////////////////////////////////////////////////
  374.     
  375.     // These globals are used to name the main menus so that
  376.     // users can add things to the end of the menus without
  377.     // hardcoding the name.
  378.     //
  379.     global string $gMainEditCurvesMenu     = "mainEditCurvesMenu";
  380.     global string $gMainSurfacesMenu     = "mainSurfacesMenu";
  381.     global string $gMainEditSurfacesMenu = "mainEditSurfacesMenu";
  382.     global string $gMainPolygonsMenu     = "mainPolygonsMenu";
  383.     global string $gMainEditPolygonsMenu = "mainEditPolygonsMenu";
  384.     global string $gMainSubdivSurfacesMenu = "mainSubdivSurfacesMenu";
  385.     // Some of the obsolete ones, but we don't want people's
  386.     // menu items to disappear just like that.
  387.     global string $gMainPrimitivesMenu      = "mainCreateMenu";
  388.     global string $gMainCurvesMenu          = "mainEditCurvesMenu";
  389.  
  390.     setParent $gMainWindow;
  391.     $menuIndex = 0;
  392.  
  393.     $gModelingMenus[$menuIndex] = 
  394.         `menu -l "Edit Curves" -aob true -to true
  395.                          -postMenuCommandOnce false
  396.                         -familyImage "menuIconEditCurves.xpm"
  397.                         $gMainEditCurvesMenu`; 
  398.         menu -e -pmc ( "ModEditCurvesMenu " + $gModelingMenus[$menuIndex] ) 
  399.             $gModelingMenus[$menuIndex];
  400.         $menuIndex++;
  401.     setParent -m ..;
  402.  
  403.     $gModelingMenus[$menuIndex] = 
  404.         `menu -l "Surfaces" -aob true -to true
  405.                  -postMenuCommandOnce false
  406.                 -familyImage "menuIconSurfaces.xpm"
  407.                 $gMainSurfacesMenu`;
  408.         menu -e -pmc ( "ModCreateSurfacesMenu " + $gModelingMenus[$menuIndex] ) 
  409.             $gModelingMenus[$menuIndex];
  410.         $menuIndex++;
  411.     setParent -m ..;
  412.  
  413.     if( `isTrue "SurfaceUIExists"` ) {
  414.         $gModelingMenus[$menuIndex] = 
  415.             `menu -l "Edit NURBS" -aob true -to true
  416.                  -postMenuCommandOnce false
  417.                 -familyImage "menuIconEditSurfaces.xpm"
  418.                 $gMainEditSurfacesMenu`;
  419.             menu -e -pmc ("ModEditSurfacesMenu " +
  420.                       $gModelingMenus[$menuIndex]) $gModelingMenus[$menuIndex];
  421.             $menuIndex++;
  422.         setParent -m ..;
  423.     }
  424.  
  425.     $gModelingMenus[$menuIndex] = 
  426.         `menu -l "Polygons" -aob true -to true
  427.                  -postMenuCommandOnce true
  428.                 -familyImage "menuIconPolygons.xpm"
  429.                 $gMainPolygonsMenu`; 
  430.         menu -e -pmc ( "PolygonsMenu " + $gModelingMenus[$menuIndex] ) 
  431.             $gModelingMenus[$menuIndex];
  432.         $menuIndex++;
  433.     setParent -m ..;
  434.  
  435.     $gModelingMenus[$menuIndex] = 
  436.         `menu -l "Edit Polygons" -aob true -to true
  437.                  -postMenuCommandOnce false
  438.                 -familyImage "menuIconPolygons.xpm"
  439.                 $gMainEditPolygonsMenu`; 
  440.         menu -e -pmc ( "EditPolygonsMenu " + $gModelingMenus[$menuIndex] ) 
  441.             $gModelingMenus[$menuIndex];
  442.         $menuIndex++;
  443.     setParent -m ..;
  444.  
  445.     
  446.       if (`isTrue "SubdivUIExists"`) {
  447.         $gModelingMenus[$menuIndex] = 
  448.           `menu -l "Subdiv Surfaces" -aob true -to true
  449.           -postMenuCommandOnce true
  450.           -familyImage "menuIconSubdivSurf.xpm" 
  451.           $gMainSubdivSurfacesMenu`; 
  452.         menu -e -pmc ( "SubdivSurfacesMenu " + $gModelingMenus[$menuIndex] ) 
  453.           $gModelingMenus[$menuIndex];
  454.         $menuIndex++;
  455.         setParent -m ..;
  456.       }
  457.  
  458.     //////////////////////////////////////////////////
  459.     //
  460.     //    Build the ANIMATION menus 
  461.     //
  462.     //////////////////////////////////////////////////
  463.     
  464.     // These globals are used to name the main menus so that
  465.     // users can add things to the end of the menus without
  466.     // hardcoding the name.
  467.     //
  468.     global string $gMainKeysMenu         = "mainKeysMenu";
  469.     global string $gMainSkeletonsMenu     = "mainSkeletonsMenu";
  470.     global string $gMainDeformationsMenu = "mainDeformationsMenu";
  471.     global string $gMainSkinningMenu     = "mainSkinningMenu";
  472.     global string $gMainConstraintsMenu     = "mainConstraintsMenu";
  473.     global string $gMainCharactersMenu     = "mainCharactersMenu";
  474.  
  475.     setParent $gMainWindow;
  476.     $menuIndex = 0;
  477.  
  478.     $gAnimationMenus[$menuIndex] = 
  479.         `menu -l "Animate" -aob true -to true
  480.             -postMenuCommandOnce true
  481.             -familyImage "menuIconKeys.xpm"
  482.             $gMainKeysMenu`;
  483.         menu -e -pmc ( "AniAnimateMenu " + $gAnimationMenus[$menuIndex] ) 
  484.             $gAnimationMenus[$menuIndex];
  485.         $menuIndex++;
  486.     setParent -m ..;
  487.  
  488.     $gAnimationMenus[$menuIndex] = 
  489.         `menu -l "Deform" -to true -aob true
  490.              -postMenuCommandOnce true
  491.             -familyImage "menuIconDeformations.xpm"
  492.             $gMainDeformationsMenu`;
  493.         menu -e -pmc ( "ChaDeformationsMenu " + $gAnimationMenus[$menuIndex] ) 
  494.             $gAnimationMenus[$menuIndex];
  495.         $menuIndex++;
  496.     setParent -m ..;
  497.  
  498.     $gAnimationMenus[$menuIndex] = 
  499.         `menu -l "Skeleton" -to true -aob true
  500.             -postMenuCommandOnce false
  501.             -familyImage "menuIconSkeletons.xpm"
  502.             $gMainSkeletonsMenu`;
  503.         menu -e -pmc ( "ChaSkeletonsMenu " + $gAnimationMenus[$menuIndex] ) 
  504.             $gAnimationMenus[$menuIndex];
  505.         $menuIndex++;
  506.     setParent -m ..;
  507.  
  508.     $gAnimationMenus[$menuIndex] = 
  509.         `menu -l "Skin" -to true -aob true
  510.             -postMenuCommandOnce true
  511.             -familyImage "menuIconSkinning.xpm"
  512.             $gMainSkinningMenu`; 
  513.     menu -e -pmc ( "ChaSkinningMenu " + $gAnimationMenus[$menuIndex] ) 
  514.         $gAnimationMenus[$menuIndex];
  515.     $menuIndex++;
  516.     setParent -m ..;
  517.  
  518.     $gAnimationMenus[$menuIndex] = 
  519.         `menu -l "Constrain" -to true -aob true 
  520.             -postMenuCommandOnce true
  521.             -familyImage "menuIconConstraints.xpm"
  522.             $gMainConstraintsMenu`; 
  523.         menu -e -pmc ( "AniConstraintsMenu " + $gAnimationMenus[$menuIndex] ) 
  524.             $gAnimationMenus[$menuIndex];
  525.         $menuIndex++;
  526.     setParent -m ..;
  527.  
  528.     $gAnimationMenus[$menuIndex] = 
  529.         `menu -l "Character" -to true -aob true
  530.              -postMenuCommandOnce false
  531.             -familyImage "menuIconCharacters.xpm"
  532.             $gMainCharactersMenu`;
  533.         menu -e -pmc ( "AniCharactersMenu " + $gAnimationMenus[$menuIndex] ) 
  534.             $gAnimationMenus[$menuIndex];
  535.         $menuIndex++;
  536.     setParent -m ..;
  537.  
  538.     //////////////////////////////////////////////////
  539.     //
  540.     //    Build the DYNAMICS menus 
  541.     //
  542.     //////////////////////////////////////////////////
  543.     
  544.     // These globals are used to name the main menus so that
  545.     // users can add things to the end of the menus without
  546.     // hardcoding the name.
  547.     //
  548.     global string $gMainDynSettingsMenu         = "mainDynSettingsMenu";
  549.     global string $gMainParticlesMenu         = "mainParticlesMenu";
  550.     global string $gMainFluidsMenu             = "mainFluidsMenu";
  551.     global string $gMainFieldsMenu             = "mainFieldsMenu";
  552.     global string $gMainDynConnectMenu         = "mainDynConnectMenu";
  553.     global string $gMainDynBodiesMenu         = "mainDynBodiesMenu";
  554.     global string $gMainDynEffectsMenu         = "mainDynEffectsMenu";
  555.  
  556.     if( `licenseCheck -m edit -type complete` == 1 )
  557.     {
  558.         if (`optionVar -q loadDynamics` || !`optionVar -ex loadDynamics`) 
  559.         {
  560.             setParent $gMainWindow;
  561.             $menuIndex = 0;
  562.     
  563.             $gDynamicsMenus[$menuIndex] = 
  564.                 `menu -l "Particles" -aob true -to true
  565.                 -postMenuCommandOnce true
  566.                 -familyImage "menuIconParticles.xpm"
  567.                 $gMainParticlesMenu`; 
  568.                 menu -e -pmc ( "DynParticlesMenu " + $gDynamicsMenus[$menuIndex] ) 
  569.                     $gDynamicsMenus[$menuIndex];
  570.                 $menuIndex++;
  571.     
  572.     
  573.             int $dynamicsIsLicensed = 
  574.                             `licenseCheck -mode "edit" -type "fx"`;
  575.                 if (!$dynamicsIsLicensed)
  576.                 {
  577.                     menu -e -enable false $gMainParticlesMenu;
  578.                 }
  579.     
  580.             setParent -m ..;
  581.  
  582.             int $fluidsIsLicensed = fluidEditLicenseFound();
  583.             if ( $fluidsIsLicensed ) {
  584.             $gDynamicsMenus[$menuIndex] =
  585.                 `menu -l "Fluid Effects" -aob true -to true
  586.                 -postMenuCommandOnce true
  587.                 -familyImage "menuIconFluids.xpm"
  588.                 $gMainFluidsMenu`;
  589.                 menu -e -pmc ( "DynCreateFluidsMenu " + $gDynamicsMenus[$menuIndex] )
  590.                     $gDynamicsMenus[$menuIndex];
  591.                 setParent -m ..;
  592.             }
  593.             else {
  594.             $gDynamicsMenus[$menuIndex] = "none";
  595.             }
  596.             $menuIndex++;
  597.  
  598.             $gDynamicsMenus[$menuIndex] = 
  599.                 `menu -l "Fields" -aob true -to true
  600.                 -postMenuCommandOnce true
  601.                 -familyImage "menuIconFields.xpm"
  602.                 $gMainFieldsMenu`; 
  603.                 menu -e -pmc ( "DynCreateFieldsMenu " + $gDynamicsMenus[$menuIndex] ) 
  604.                     $gDynamicsMenus[$menuIndex];
  605.                 $menuIndex++;
  606.             setParent -m ..;
  607.     
  608.             //$gDynamicsMenus[$menuIndex] = `menu -l "Connect/Add" -to true
  609.             //                -postMenuCommandOnce true
  610.             //                -familyImage "menuIconConnect.xpm"
  611.             //                $gMainDynConnectMenu`;
  612.             //   menu -e -pmc ( "DynConnectMenu " + $gDynamicsMenus[$menuIndex] ) 
  613.             //        $gDynamicsMenus[$menuIndex];
  614.             //    $menuIndex++;
  615.             //setParent -m ..;
  616.     
  617.             $gDynamicsMenus[$menuIndex] = 
  618.                 `menu -l "Soft/Rigid Bodies" -aob true -to true
  619.                 -postMenuCommandOnce true
  620.                 -familyImage "menuIconBodies.xpm"
  621.                 $gMainDynBodiesMenu`;
  622.     //          `menu -l "Soft/Rigid Body" -aob true -to true`;
  623.                 menu -e -pmc ( "DynSoftRigidBodyMenu " + $gDynamicsMenus[$menuIndex] ) 
  624.                     $gDynamicsMenus[$menuIndex];
  625.                 $menuIndex++;
  626.             setParent -m ..;
  627.     
  628.             $gDynamicsMenus[$menuIndex] = 
  629.                 `menu -l "Effects" -aob true -to true
  630.                 -postMenuCommandOnce true
  631.                 -familyImage "menuIconBodies.xpm"
  632.                 $gMainDynEffectsMenu`;
  633.                 menu -e -pmc ( "DynClipEffectsMenu " + $gDynamicsMenus[$menuIndex] ) 
  634.                     $gDynamicsMenus[$menuIndex];
  635.                 $menuIndex++;
  636.             setParent -m ..;
  637.  
  638.             $gDynamicsMenus[$menuIndex] = `menu -l "Solvers" -aob true -to true
  639.                 -postMenuCommandOnce true
  640.                 -familyImage "menuIconSettings.xpm"
  641.                 $gMainDynSettingsMenu`;
  642.                 menu -e -pmc ( "DynSettingsMenu " + $gDynamicsMenus[$menuIndex] ) 
  643.                     $gDynamicsMenus[$menuIndex];
  644.                 $menuIndex++;
  645.             setParent -m ..;
  646.     
  647.         }
  648.     }
  649.  
  650.  
  651.     //////////////////////////////////////////////////
  652.     //
  653.     //    Build the RENDERING menus 
  654.     //
  655.     //////////////////////////////////////////////////
  656.  
  657.     // These globals are used to name the main menus so that
  658.     // users can add things to the end of the menus without
  659.     // hardcoding the name.
  660.     //
  661.     global string $gMainShadingMenu        = "mainShadingMenu";
  662.     global string $gMainRenTexturingMenu = "mainRenTexturingMenu";//cm
  663.     global string $gMainRenderMenu        = "mainRenderMenu";
  664.  
  665.     // The light menu was removed for Maya 3.0
  666.     // Setting this global to the shading menu to not break
  667.     // customer scripts
  668.     //
  669.     global string $gMainLightingMenu    = "mainShadingMenu";
  670.  
  671.     if (`optionVar -q loadRendering` || !`optionVar -ex loadRendering`)
  672.     {
  673.         setParent $gMainWindow;
  674.         $menuIndex = 0;
  675.  
  676.         $gRenderingMenus[$menuIndex] = 
  677.             `menu -l "Lighting/Shading" -aob true -to true 
  678.             -postMenuCommandOnce true
  679.             -familyImage "menuIconShading.xpm"
  680.             $gMainShadingMenu`;
  681.             menu -e -pmc ( "RenShadersMenu " + $gRenderingMenus[$menuIndex] ) 
  682.                 $gRenderingMenus[$menuIndex];
  683.             $menuIndex++;
  684.         setParent -m ..;
  685.  
  686. //cm
  687.         $gRenderingMenus[$menuIndex] = 
  688.             `menu -l "Texturing" -aob true -to true 
  689.             -postMenuCommandOnce true
  690.             -familyImage "menuIconTexturing.xpm"
  691.             $gMainRenTexturingMenu`;
  692.             menu -e -pmc ( "RenTexturingMenu " + $gRenderingMenus[$menuIndex] ) 
  693.                 $gRenderingMenus[$menuIndex];
  694.             $menuIndex++;
  695.         setParent -m ..;            
  696.  
  697.         $gRenderingMenus[$menuIndex] = 
  698.             `menu -l "Render" -aob true -to true -pmo true
  699.                 -familyImage "menuIconRender.xpm"
  700.                 $gMainRenderMenu`; 
  701.             menu -e -pmo 0 -pmc ( "RenRenderMenu " + $gRenderingMenus[$menuIndex] ) 
  702.                 $gRenderingMenus[$menuIndex];
  703.             $menuIndex++;
  704.         setParent -m ..;
  705.     }
  706.  
  707.     //////////////////////////////////////////////////////////////////
  708.     //
  709.     // Maya Paint Effects
  710.     //
  711.     //////////////////////////////////////////////////////////////////
  712.     if (`isTrue MayaCreatorExists`) { 
  713.         eval "source CreatorMenu";
  714.  
  715.     }
  716.  
  717.     //////////////////////////////////////////////////////////////////
  718.     //
  719.     // Note: Maya Unlimited Plug-In Menus are built in their UI init
  720.     //       sections. (ie cloth,live)
  721.     //
  722.     //////////////////////////////////////////////////////////////////
  723.  
  724.  
  725.     //////////////////////////////////////////////////
  726.     //
  727.     //    Build the help and auxiliary menus 
  728.     //
  729.     //////////////////////////////////////////////////
  730.  
  731.     if (`exists AuxiliaryMenus`) { 
  732.         eval "source AuxiliaryMenus";
  733.     } 
  734.     if (`exists AuxiliaryGraphicsMenus.mel`) { 
  735.         eval "source AuxiliaryGraphicsMenus";
  736.     } 
  737.     if (`exists HelpMenu`) { 
  738.         eval "source HelpMenu";
  739.     }
  740.  
  741.     // Get the current menu mode from the preferences.
  742.     // If the one in the preferences isn't recognized, then
  743.     // default to Animation.
  744.     //
  745.     string $menuMode = `optionVar -query currentMenuBarTab`;
  746.     if($menuMode != "Modeling" 
  747.        && $menuMode != "Animation"
  748.        && $menuMode != "Dynamics"
  749.        && $menuMode != "Rendering"
  750.        && $menuMode != "Cloth"
  751.        && $menuMode != "Live") {
  752.         $menuMode = "Animation";
  753.     }
  754.     setMenuMode $menuMode;
  755.     updateMenuModeUI;
  756.  
  757.     // When the menu mode changes, make sure that the menus are updated.
  758.     //
  759.     scriptJob -permanent -event "MenuModeChanged" "updateMenuModeUI";
  760. }
  761.  
  762.